package day04;

/**
 * @author yzh
 * @desc TODO
 * @date 2025/4/11
 */
import java.util.Scanner;
import java.util.Random;

public class GradeAnalyze {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Random random = new Random();

        System.out.print("请输入班级人数:");
        int classSize = sc.nextInt();

        int[] grades = new int[classSize];

        for (int i = 0; i < grades.length; i++) {
            grades[i] = random.nextInt(101);
        }

        int failCount = 0; // 不及格人数
        int totalScore = 0; // 总分

        for (int grade : grades) {
            if (grade < 60) {
                failCount++;
            }
            totalScore += grade;
        }

        double averageScore = (double) totalScore / classSize;

        System.out.println("不及格人数:" + failCount);
        System.out.println("班级平均分:" + (int) averageScore); // 输出整数部分
    }
}